package realtime.app.func;

import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;
import realtime.app.func.KeywordUDTF;
import realtime.util.KeywordUtil;

@FunctionHint(output = @DataTypeHint("ROW<word STRING>"))
public class KeywordUDTF extends TableFunction<Row> {
    public void eval(String text) {
        for (String key : KeywordUtil.analyze(text)) {
            collect(Row.of(key));
        }
    }
}